The present invention generally relates to query plan and more particularly towards validating query plan for optimal usage of resources.
A database is an ordered collection of data, where data is logically stored as a series of rows and columns in one or more tables. To access one or more rows or columns of data from the tables, query to the database is made using one or more query statements. The query statement declares amount of data to be retrieved and represented. In one example, the query statement can mention description such as identity of fields, a join between different fields, the database to return the values for the identified fields, rows in order to be generated as a result (product). Before the query is run, the query plan is generated. The query plan determines the sequence of functions (operations) to be performed on those tables and relations between the identified tables, in the database to achieve the desired results.
At times, if a poorly written query is allowed to run, based on the generated query plan, it may cause overall performance of the database to suffer. The query plan could have failed to achieve the desired result, because it may not have dealt with all the different types of work being executed within the database server. Also, the query may have been a badly written query, as a result of common typing omissions, and thus lead to an end result which is not the desired result. Therefore, to make certain the end result has accuracy, consistency and reliability of the data from the database, the query plans which are generated need to be analyzed to ensure desired query results.